package com.metro.activation.demo.controller;

import com.metro.core.excel.JxlsView;
import com.metro.activation.common.beans.constant.JxlsTemplateEnum;
import com.metro.activation.sys.beans.vo.SysPermission;
import com.metro.activation.sys.service.inf.ISysPermissionService;
import com.metro.activation.web.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * Created by xk on 2017/12/5 0005.
 */
@Controller()
@RequestMapping(value = "/demo")
public class DemoController extends BaseController {

    @Autowired
    private ISysPermissionService sysPermissionService;

    @RequestMapping(value="index")
    public String index(){
        return "/activation/index";
    }

    @RequestMapping(value = "/export/jxls", method = RequestMethod.GET)
    public ModelAndView exportJxls() {
        SysPermission entity = null;
        List<SysPermission> list = sysPermissionService.queryForList(entity);
        return new ModelAndView(new JxlsView(JxlsTemplateEnum.DEMO, list));
    }
}
